package cli

import (
	"bytes"
	"os/exec"
	"strings"
)

func NewSpringBootCli() *SpringBootCli {
	return &SpringBootCli{
		ignorePkgs:   []string{"spring_gen"},
		rootPattern:  "./...",
		ignoreStdLib: true,
		meta:         make(map[string]interface{}),
	}
}

// 获取本地 Go 标准库包列表
func getStdLibList() []string {
	cmd := exec.Command("go", "list", "std")
	var out bytes.Buffer
	cmd.Stdout = &out
	if err := cmd.Run(); err != nil {
		return nil
	}

	lines := strings.Split(strings.TrimSpace(out.String()), "\n")
	return lines
}
